<template>
  <div class="big-header">
    <div class="big-header-text">
      <div>审查调查全周期预警系统</div>
    </div>
    <div class="big-header-main">
      <div class="big-header-left">
        {{ weather.temperature }}° {{ weather.weather }}
      </div>
      <div class="big-header-right">
        {{ date.time }}
      </div>
    </div>
  </div>
</template>
<script>
import dayjs from 'dayjs'
export default {
  data() {
    return {
      date: {
        time: '20:20:20',
        day: '2023-02-01'
      },
      weather: {
        temperature: 10,
        weather: '晴朗',
        address: '成都',
        humidity: 0
      },
      timr: null
    }
  },
  mounted() {
    setTimeout(() => {
      // this.initWeather();
    }, 5000)
    this.timr = setInterval(() => {
      this.date.time = dayjs(new Date()).format('HH:mm:ss')
      this.date.day = dayjs(new Date()).format('YYYY-MM-DD')
    }, 1000)
  },
  beforeDestroy() {
    clearInterval(this.timr)
  },
  methods: {
    initWeather() {
      // 创建天气查询实例
      // const weathers = new AMap.Weather();
      // //执行实时天气信息查询
      // weathers.getLive("成都市", function (err, data) {
      //   console.log(err, data);
      //   weather.weather = data.weather;
      //   weather.temperature = data.temperature;
      //   weather.humidity = data.humidity;
      // });
    }
  }
}
</script>
<style lang="scss">
.big-header {
  height: 96px;
  width: 100%;
  background: url("../assets/images/header/header.png");
  background-size: 100% 96px;
  position: relative;
  z-index: 9;

  &-main {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 30px;
    position: absolute;
    right: 30px;
    top: 10px;
    font-size: 20px;
  }
  &-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    font-family: Alimama ShuHeiTi;
    font-weight: bold;
    font-size: 42px;
    color: #ffffff;
    line-height: 89px;
    gap: 28px;
    background: linear-gradient(0deg, #88b8ff 0%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
</style>
